﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace blackhouse.BlackApart.Data.Caching {
    public class CachedDataAccess : IDataFactory {

        #region Fields

        private IDataFactory decoratedDataAccess;
        private string connectionString;

        #endregion

        #region Constructors

        public CachedDataAccess(IDataFactory dataAccess, string connToNemoCache) {
            this.decoratedDataAccess = dataAccess;
            this.connectionString = connToNemoCache;
        }

        #endregion

        #region Methods

        public INewsletterDataAccess GetNewsletterDataAccess() {
            return this.decoratedDataAccess.GetNewsletterDataAccess();
        }

        public IPlaceDataAccess GetPlaceData() {
            return new CachedPlaceData(this.decoratedDataAccess.GetPlaceData(), this.connectionString);
        }

        public IPushMailDataAccess GetPushMailData() {
            return this.decoratedDataAccess.GetPushMailData();
        }

        public IApartmentGroupDataAccess GetApartmentDataGroup() {
            return new CachedApartmentGroupDataAccess(this.decoratedDataAccess.GetApartmentDataGroup(), this.connectionString);
        }

        public IApartmentDataAccess GetApartmentData() {
            return new CachedApartmentDataAccess(this.decoratedDataAccess.GetApartmentData(), this.connectionString);
        }

        public IApartmentLocationDataAccess GetApartmentLocationData() {
            return this.decoratedDataAccess.GetApartmentLocationData();
        }

        public IReservationDataAccess GetReservationData() {
            return new CachedReservationDataAccess(this.decoratedDataAccess.GetReservationData(), this.connectionString);
        }

        public IPricesDataAccess GetPricesData() {
            return new CachedPricesDataAccess(this.decoratedDataAccess.GetPricesData(), this.connectionString);
        }

        public IFurnitureDataAccess GetFurnitureData() {
            return new CachedFurnitureDataAccess(this.decoratedDataAccess.GetFurnitureData(), this.connectionString);
        }

        public IOpinionsDataAccess GetOpinionsData() {
            return new CachedOpinionsDataAccess(this.decoratedDataAccess.GetOpinionsData(), this.connectionString);
        }

        public IMailTemplateDataAccess GetMailTemplateData() {
            return this.decoratedDataAccess.GetMailTemplateData();
        }

        public IActionDataAccess GetActionData() {
            return this.decoratedDataAccess.GetActionData();
        }

        public IAdditionalServiceDataAccess GetAdditionalServicesData() {
            return this.decoratedDataAccess.GetAdditionalServicesData();
        }

        public ReservationServiceSaveTransaction GetReservationServiceSaveTransaction() {
            return this.decoratedDataAccess.GetReservationServiceSaveTransaction();
        }

        #endregion

    }
}
